package com.example.demo.mapper;

import com.example.demo.domain.dao.TeacherCourse;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author lizijian
 */
@Mapper
public interface CourseDao {

  @Select("SELECT DISTINCT course_name FROM hbut_teacher_course WHERE teacher_name = #{teacherName}")
  List<String> getCourseByTeacherName(String teacherName);


  @Select("SELECT * FROM hbut_teacher_course WHERE teacher_name =#{teacherName} AND course_name =#{courseName} ")
  List<TeacherCourse> getTeacherCourse(@Param("courseName") String courseName,@Param("teacherName") String teacherName);

  @Delete("TRUNCATE TABLE hbut_teacher_course")
  void deleteTeacherCourse();

  @Select("SELECT DISTINCT teacher_name FROM hbut_teacher_course WHERE teacher_name LIKE #{teacherName} ")
  List<String> getTeacherName(String teacherName);

  @Select("SELECT id FROM course_classroom WHERE `name` =#{name} AND campus_id =#{campusId}")
  Integer getClassroomId(@Param("name") String name,@Param("campusId") Integer campusId);

}
